#!/usr/local/bin/python3
# -*- coding: utf-8 -*-

"""
@File    :鼠标事件.py
@Author  :keyin
@Time    :2021-02-03 16:52
"""
import numpy as np
import cv2


# x1, y1, x2, y2, x3, y3, x4, y4 = 0

def draw_circle(event, x, y, flags, param):
    if event == cv2.EVENT_LBUTTONDOWN:
        cv2.circle(img, (x, y), 10, (255, 0, 0), -1)
        print('x=', x, '-------y=', y)

def draw_line():
    pass

img = np.zeros((512, 512, 3), np.uint8)
cv2.namedWindow('image')
cv2.setMouseCallback('image', draw_circle)

while (1):
    cv2.imshow('image', img)
    if cv2.waitKey(20) & 0XFF == 27:
        break

cv2.destroyAllWindows()